import java.util.Scanner;

public class Main {

    //棋盘
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        // 初始化二维差分数组，尺寸为(n+2)x(n+2)
        int[][] sum = new int[n+2][n+2];

        // 处理m次矩形区域的差分标记
        for (int k = 0; k < m; k++) {
            int x1 = scanner.nextInt();
            int y1 = scanner.nextInt();
            int x2 = scanner.nextInt();
            int y2 = scanner.nextInt();
            // 二维差分标记的四个角操作
            // 1^0 = 1 , 1^1 = 0
            sum[x1][y1] ^= 1;
            sum[x2+1][y2+1] ^= 1;
            sum[x1][y2+1] ^= 1;
            sum[x2+1][y1] ^= 1;
        }

        // 两次前缀异或计算得到最终矩阵
        for (int i = 1; i <= n; i++) {
            // 横向异或前缀
            for (int j = 1; j <= n; j++) {
                sum[i][j] ^= sum[i][j-1];
            }
            // 纵向异或前缀
            for (int j = 1; j <= n; j++) {
                sum[i][j] ^= sum[i-1][j];
            }
        }

        // 输出结果矩阵
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= n; j++) {
                System.out.print(sum[i][j]);
            }
            System.out.println();
        }
    }
}
